Skip to content

Add unit and routing tests for Halo API commands and improve coverage#78

Merged
homotechsual merged 31 commits into
mainfrom
develop
Apr 29, 2026
Merged

Add unit and routing tests for Halo API commands and improve coverage#78
homotechsual merged 31 commits into
mainfrom
develop

Conversation

@homotechsual

Copy link
Copy Markdown
Owner

This pull request introduces improvements to code coverage management, batch processing, and bug fixes, along with some documentation and metadata updates. The most significant changes are the addition of a Codecov component mapping system, a refactor of batch processing logic, and a fix for ticket pagination. The minimum code coverage threshold in CI has also been raised, and some minor corrections and enhancements have been made across the codebase and documentation.

Codecov component management and CI integration:

  • Added a new DevOps/Quality/codecov-components-map.json file as the source of truth for code coverage components, and a script Generate-CodecovComponents.ps1 to generate the .codecov.yml configuration from this map, with validation support in CI. This enables more granular code coverage reporting by component. ([[1]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-9424249d4bfd469deb49bb84ef0ffa4b9a8421f124188bfef14ccc75e634540dR1-R65), [[2]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-1e49dad08a5d32ef333239526ae9c67ee30e11a086650277f4c8f24ea1a3b189R1-R98), [[3]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-634d76b7f070f597b9ac88e9bff4e91440c20a608f21d428b09b1bb8aa7682d4R1-R48), [[4]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-b803fcb7f17ed9235f1e5cb1fcd2f5d3b2838429d4368ae4c57ce4436577f03fR91-R96))
  • CI workflow now validates that .codecov.yml matches the generated configuration and increases the minimum required unit test coverage from 20% to 70%. Documentation and workspace settings were updated to reflect this new threshold. ([[1]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-b803fcb7f17ed9235f1e5cb1fcd2f5d3b2838429d4368ae4c57ce4436577f03fL144-R150), [[2]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-b3f264e673efcdd0d957c3b273df2879b4d958b90e13782b9a143e0c5b3137fdL29-R29), [[3]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-a00e0c7830209edf9d1949f0b675351c1897d645759b7dc8483304c0b9bcf8e0R227-R241))

Batch processing improvements:

  • Refactored batch processing in Invoke-HaloBatchProcessor.ps1 by extracting the connection and command invocation logic into a new helper function Invoke-HaloBatchItem, improving readability and maintainability. ([[1]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-a5a90ce17a3899e8d49b77c41aed3504650a19ffbf8b335a9de3707b2eb75b2aR2-R56), [[2]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-a5a90ce17a3899e8d49b77c41aed3504650a19ffbf8b335a9de3707b2eb75b2aL55-L90))

Bug fixes and behavioral changes:

  • Fixed Get-HaloTicket so that specifying -PageNo or -PageSize disables auto-pagination, aligning behavior with user expectations. ([Public/Get/Get-HaloTicket.ps1R297-R301](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-1305d65f0eefa7692e4bfa4b4db6a22b83e4fc4d49fafa08dd3e08e953681346R297-R301))
  • Corrected pluralization and parameter usage in New-HaloOpportunityBatch for consistency and correctness. ([Public/New/New-HaloOpportunityBatch.ps1L23-R26](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-fe373ef37ce4eff42ae8595252a98b6bcecb849cbb7e67360e386238972499faL23-R26))
  • Improved error handling and retry logic in Connect-HaloAPI for authentication requests, ensuring error messages reference the correct retry count and only trigger when appropriate. ([[1]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-3ece530c03f1924159401ba6fb6295fe9715b10d7156a2f86c0f16c8defd9b21R135), [[2]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-3ece530c03f1924159401ba6fb6295fe9715b10d7156a2f86c0f16c8defd9b21L152-R155), [[3]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-3ece530c03f1924159401ba6fb6295fe9715b10d7156a2f86c0f16c8defd9b21R219), [[4]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-3ece530c03f1924159401ba6fb6295fe9715b10d7156a2f86c0f16c8defd9b21R260-L263))

Documentation and metadata:

  • Updated documentation badges for Codecov and Discord, and incremented the module version to 1.23.1 in the manifest and changelog to reflect the latest changes. ([[1]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L4-R8), [[2]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-b3f264e673efcdd0d957c3b273df2879b4d958b90e13782b9a143e0c5b3137fdL13-R13), [[3]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-2777d45ffa71199d526b654e6524e71b85f753979f5366026eb4ee426ccc3434L15-R15), [[4]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4edR5-R8))
  • Cleaned up the workspace file by removing an unrelated folder reference. ([HaloAPI.code-workspaceL5-R5](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-a00e0c7830209edf9d1949f0b675351c1897d645759b7dc8483304c0b9bcf8e0L5-R5))

These changes collectively improve code quality, maintainability, and reliability, especially around test coverage and batch operations.

homotechsual and others added 30 commits April 28, 2026 10:09
… Get-HaloSupplier, and Get-HaloItem cmdlets

fix(ci): update minimum coverage threshold for Unit suite to 25%

Co-authored-by: Copilot <copilot@github.com>
…ibutionList, Get-HaloTab, Get-HaloKBArticle, Get-HaloSoftwareLicence, and Get-HaloOpportunity cmdlets
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
…-HaloWorkday, Get-HaloOutcome, and Get-HaloFAQList
Co-authored-by: Copilot <copilot@github.com>
feat(tests): add routing tests for Get-HaloWorkflow, Get-HaloService, Get-HaloBillingTemplate, Get-HaloCustomButton, and Get-HaloViewList

Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
docs: update documentation to reflect new coverage threshold for Unit suite
test: add routing tests for new Halo API commands

Co-authored-by: Copilot <copilot@github.com>
… add Codecov component validation

Co-authored-by: Copilot <copilot@github.com>
…aloQuote, New-HaloRecurringInvoice, New-HaloReport, and New-HaloService commands
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
…Contract, New-HaloCRMNote, New-HaloCustomButton, and New-HaloDashboard commands
…InvoiceBatch, New-HaloItem, New-HaloItemBatch, and New-HaloKBArticle commands
Co-authored-by: Copilot <copilot@github.com>
Copilot AI review requested due to automatic review settings April 29, 2026 20:40
@homotechsual homotechsual merged commit 9bb7032 into main Apr 29, 2026
6 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves CI/unit test coverage enforcement and Codecov reporting granularity, while refactoring batch processing and fixing a ticket pagination behavior.

Changes:

  • Added Codecov component mapping + generator script, and CI validation to prevent .codecov.yml drift.
  • Refactored batch processing by extracting per-item execution into Invoke-HaloBatchItem.
  • Fixed Get-HaloTicket manual pagination behavior and improved authentication retry error reporting; updated docs/metadata and raised CI unit coverage minimum to 70%.

Reviewed changes

Copilot reviewed 15 out of 17 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
temp_results.txt Adds local test output transcript (should not be committed).
cspell.json Adds shared cspell dictionary config and ignore paths.
README.md Updates badges/links and documents the new 70% unit coverage threshold.
Public/New/New-HaloOpportunityBatch.ps1 Fixes pluralization and uses the correct parameter variable for batch input.
Public/Get/Get-HaloTicket.ps1 Disables auto-pagination when -PageNo/-PageSize are explicitly provided.
Public/Connect-HaloAPI.ps1 Tightens auth/authinfo retry messaging and retry tracking variables.
Private/Invoke-HaloBatchProcessor.ps1 Extracts per-item connection + invocation into Invoke-HaloBatchItem.
HaloAPI.psd1 Bumps module version to 1.23.1.
HaloAPI.code-workspace Workspace cleanup + updated spellings + terminal auto-approve patterns (one still references 20%).
Docs/HaloAPI/index.mdx Updates Codecov badge/link and documents 70% unit coverage threshold.
DevOps/Quality/codecov-components-map.json Introduces the JSON source-of-truth for Codecov components.
DevOps/Quality/Generate-CodecovComponents.ps1 Adds generator/validator script for .codecov.yml based on the JSON map.
CHANGELOG.md Adds 1.23.1 entry for ticket pagination behavior change.
.gitignore Ignores additional local test/output artifacts (but not temp_results.txt).
.github/workflows/ci.yml Validates Codecov config drift and raises unit coverage minimum from 20% to 70%.
.codecov.yml Adds generated Codecov component configuration.

Comment thread temp_results.txt
Comment on lines +1 to +6
Set-PSReadLineOption: C:\Users\MichaelO'Toole\OneDrive - MJCO\Documents\PowerShell\Microsoft.PowerShell_profile.ps1:491:1
Line |
 491 |  Set-PSReadLineOption -PredictionSource History
 |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 | The predictive suggestion feature cannot be enabled because the console
 | output doesn't support virtual terminal processing or it's redirected.

Copilot AI Apr 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like local test output / console transcript (includes ANSI escape sequences and a user-specific local path). It shouldn’t be checked into the repo; please delete this file from the PR history and add an ignore rule so it can’t be reintroduced accidentally.

Copilot uses AI. Check for mistakes.
Comment thread HaloAPI.code-workspace
Comment on lines +227 to +230
"/^pwsh -File \\.\\\\DevOps\\\\Quality\\\\test\\.ps1 -Suite Unit -Verbosity Detailed -CodeCoverage -MinimumCoveragePercent 20$/": {
"approve": true,
"matchCommandLine": true,
},

Copilot AI Apr 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The terminal auto-approve rule is still keyed to running unit tests with -MinimumCoveragePercent 20, but CI/docs in this PR raise the unit minimum to 70. Update this regex to match the new minimum (or remove it) so local runs align with CI expectations.

Copilot uses AI. Check for mistakes.
} while ((-not $AuthInfoResponse) -and ($AuthRetries -lt 10))
if ($AuthInfoRetries -gt 1) {
New-HaloError -ModuleMessage ('Retried auth info request {0} times, request unsuccessful.' -f $Retries)
} while ((-not $AuthInfoResponse) -and ($AuthInfoRetries -lt 10))

Copilot AI Apr 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These retry loops are hard-coded to 10 attempts. Since Connect-HaloAPI exposes a -MaxRetries parameter (and stores it in connection info), consider using $MaxRetries here as well to avoid surprising behavior when callers override it and to remove the magic number.

Suggested change
} while ((-not $AuthInfoResponse) -and ($AuthInfoRetries -lt 10))
} while ((-not $AuthInfoResponse) -and ($AuthInfoRetries -lt $MaxRetries))

Copilot uses AI. Check for mistakes.
Comment on lines 259 to +262
} while ((-not $Authenticated) -and ($AuthRetries -lt 10))
if ((-not $Authenticated) -and ($AuthRetries -gt 1)) {
New-HaloError -ModuleMessage ('Retried auth request {0} times, request unsuccessful.' -f $AuthRetries)
}

Copilot AI Apr 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above: this auth retry loop is fixed at 10 attempts. Use $MaxRetries (or a shared constant derived from it) so the cmdlet’s retry configuration applies consistently during authentication too.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants